//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.timerecording.localDateTime;

import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.TextStyle;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.Locale;

class SmartLocalDateUtil {
    public static final String YMD = "yyyy-MM-dd";
    public static final String YM = "yyyy-MM";
    public static final String YMD_HMS = "yyyy-MM-dd HH:mm:ss";
    public static final String YMD_HM = "yyyy-MM-dd HH:mm";
    public static final DateTimeFormatter FORMATTER_YM = DateTimeFormatter.ofPattern("yyyy-MM");
    public static final DateTimeFormatter FORMATTER_YMD = DateTimeFormatter.ofPattern("yyyy-MM-dd");
    public static final DateTimeFormatter FORMATTER_YMDHM = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
    public static final DateTimeFormatter FORMATTER_YMDHMS = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

    public SmartLocalDateUtil() {
    }

    public static String formatYM(LocalDateTime localDateTime) {
        return localDateTime.format(FORMATTER_YM);
    }

    public static String formatYMD(LocalDateTime localDateTime) {
        return localDateTime.format(FORMATTER_YMD);
    }

    public static String formatYMD(LocalDate localDate) {
        return localDate.format(FORMATTER_YMD);
    }

    public static String formatYMDHM(LocalDateTime localDateTime) {
        return localDateTime.format(FORMATTER_YMDHM);
    }

    public static String formatYMDHMS(LocalDateTime localDateTime) {
        return localDateTime.format(FORMATTER_YMDHMS);
    }

    public static String formatYMDHMS(LocalDate localDate) {
        return localDate.format(FORMATTER_YMDHMS);
    }

    public static LocalDate parseYMD(String dateStr) {
        return LocalDate.parse(dateStr, FORMATTER_YMD);
    }

    public static LocalDateTime parseYMDHM(String dateStr) {
        return LocalDateTime.parse(dateStr, FORMATTER_YMDHM);
    }

    public static LocalDateTime parseYMDHMS(String dateStr) {
        return LocalDateTime.parse(dateStr, FORMATTER_YMDHMS);
    }

    public static long currentSecond() {
        return System.currentTimeMillis() / 1000L;
    }

    public static String currentDate() {
        return formatYMD(LocalDateTime.now());
    }

    public static String currentDateTime() {
        return formatYMDHMS(LocalDateTime.now());
    }

    public static String formatToChineseWeek(LocalDate localDate) {
        return localDate.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINESE);
    }

    public static String formatToChineseWeekZhou(LocalDate localDate) {
        return formatToChineseWeek(localDate).replace("星期", "周");
    }

    public static LocalDateTime toLocalDateTime(Date date) {
        return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDateTime();
    }

    public static Long getDayBalanceSecond() {
        LocalDateTime now = LocalDateTime.now();
        return Duration.between(now, now.plusDays(1L).with(LocalTime.MIN)).get(ChronoUnit.SECONDS);
    }

    public static void main(String[] args) {
        System.out.println(getDayBalanceSecond());
    }
}
